package com.lm.activiti.boot.cases.sorts;

import com.alibaba.fastjson.JSON;
import org.junit.Test;

/**
 * @author lm_jcf
 * @date 2022/6/29 9:55
 */
public class DubbleSort {

    @Test
    public void sort() {

        int[] nums = new int[]{2,15,7,1,88,19,100};

        for (int i = 0; i < nums.length; i++) {
            for (int j = 0; j < nums.length - 1; j++) {
                if (nums[j] > nums[j + 1]) {
                    int tp = nums[j];
                    nums[j ] = nums[j+ 1];
                    nums[j+ 1] = tp;
                }
            }
        }

        System.out.println(JSON.toJSONString(nums));
    }
}
